package com.service.lx;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dao.lx.FunctionalclassifyDAO;
import com.entity.Functionalclassify;
import com.service.ServiceException;


@Service
@Transactional(rollbackFor = Exception.class)
public class FunctionalclassifyService {
	@Autowired
	private FunctionalclassifyDAO functionalclassifyDAO;
	/**
	 * 添加/修改/逻辑删除
	 * @param user
	 * @throws ServiceException
	 */
	public void addAndUpdateFunctionalclassify(Functionalclassify functionalclassify) throws ServiceException{
		try {
			functionalclassify.setFunctionalclassifyIntodate(new Date());
			functionalclassifyDAO.save(functionalclassify);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServiceException(e);
		}
	}
	
	/**
	 * 删除
	 * @param functionalclassifyid
	 * @throws ServiceException
	 */
	public void deleteFunctionalclassify(Long functionalclassifyid) throws ServiceException{
		try {
			functionalclassifyDAO.delete(functionalclassifyid);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServiceException(e);
		}
	}
	/**
	 * 单条查询
	 * @param functionalclassifyid
	 * @return
	 */
	public Functionalclassify findOne(Long functionalclassifyid) {
		return functionalclassifyDAO.findOne(functionalclassifyid);
	}

	/**
	 * 查询所有分类
	 * @return
	 */
	public List<Functionalclassify> findAll() {
		return (List<Functionalclassify>) functionalclassifyDAO.findAll();
	}
}
